

<!-- ADMIN HOME -->
<div class="row" ng-if="original_user && original_user.admin">
    <div class="col-sm-3 center-block">
        <!-- SERVER INFO -->
        <div class="tile menu">
            <div class="menu-item text-center">
                <p>Plik Version : {{version.version}}</p>
                <p>{{version.goVersion}}</p>

                <p>
                    <span ng-class="'label label-' + (version.isRelease ? 'success' : 'danger')">release</span>
                    &nbsp;
                    <span ng-class="'label label-' + (version.isMint ? 'success' : 'danger')">mint</span>
                </p>
            </div>
        </div>
        <!-- STATS BUTTON -->
        <div class="tile menu">
            <div class="menu-item">
                <button type="button" class="btn btn-lg btn-primary btn-block" ng-click="displayStats()">
                    <i class="fa fa-line-chart"></i> Stats
                </button>
            </div>
        </div>
        <!-- UPLOADS BUTTON -->
        <div class="tile menu">
            <div class="menu-item">
                <button type="button" class="btn btn-lg btn-primary btn-block" ng-click="displayUploads()">
                    <i class="fa fa-files-o"></i> Uploads
                </button>
            </div>
        </div>
        <!-- USERS BUTTON -->
        <div class="tile menu">
            <div class="menu-item">
                <button type="button" class="btn btn-lg btn-primary btn-block" ng-click="displayUsers()">
                    <i class="fa fa-users"></i> Users
                </button>
            </div>
        </div>
        <!-- CREATE USER BUTTON -->
        <div class="tile menu">
            <div class="menu-item">
                <button type="button" class="btn btn-lg btn-primary btn-block" ng-click="createUser()">
                    <i class="fa fa-user"></i> Create User
                </button>
            </div>
        </div>
    </div>
    <!-- MAIN -->
    <div class="col-sm-9">
        <!-- STATS -->
        <div ng-if="display=='stats' && stats">
            <div class="row">
                <div class="col-sm-12 col-centered">
                    <div class="tile panel panel-body main">
                        <div class="row center-block text-center">
                            <p>
                                Max File Size : {{humanReadableSize(config.maxFileSize)}}
                            </p>
                            <p>
                                Max User Size : {{humanReadableSize(config.maxUserSize)}}
                            </p>
                            <p>
                                Default TTL : {{getHumanReadableTTLString(config.defaultTTL)}}
                            </p>
                            <p>
                                Max TTL : {{getHumanReadableTTLString(config.maxTTL)}}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12 col-centered">
                    <div class="tile panel panel-body main">
                        <div class="row center-block text-center">
                            <p>
                                Users : {{stats.users}}
                            </p>
                            <p>
                                Uploads : {{stats.uploads}}
                            </p>
                            <p>
                                Anonymous Uploads : {{stats.anonymousUploads}}
                            </p>
                            <p>
                                Files : {{stats.files}}
                            </p>
                            <p>
                                Total Size : {{ humanReadableSize(stats.totalSize) }}
                            </p>
                            <p>
                                Anonymous Total Size : {{ humanReadableSize(stats.anonymousTotalSize) }}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- USERS -->
        <div class="row" ng-if="display=='users'">
            <div class="col-sm-12 col-centered">
                <div class="tile panel panel-body main">
                    <div class="row center-block text-center" ng-if="fake_user">
                        <div class="tile panel panel-body main text-center">
                            <p>
                                Hello {{original_user.name}}. You are currently impersonating {{fake_user.name}} ({{fake_user.id}}).
                            </p>

                            <div class="col-xs-10 col-sm-8 col-md-6 col-xs-offset-1 col-sm-offset-2 col-md-offset-3 text-center">
                                <div class="input-group">
                                    <!-- CANCEL IMPERSONATE BUTTON -->
                                    <div class="input-group-btn">
                                        <button title="Browse" type="button" class="btn btn-danger"
                                                ng-click="impersonate()">
                                            <i class="glyphicon glyphicon-remove"></i>
                                            <span class="hidden-xs hidden-sm hidden-md"> Cancel</span>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row center-block text-center">
                        <div class="tile panel panel-body main text-center" ng-repeat="user in users">
                            <div class="row">
                                <div class="col-sm-3">
                                    {{user.login}}<br/>
                                    ({{user.provider}})<br/>
                                    <p ng-if="user.admin"><span class="label label-success">admin</span></p>
                                </div>
                                <div class="col-sm-3 hidden-md hidden-sm hidden-xs">
                                    {{user.name}}<br/>
                                    {{user.email}}
                                </div>
                                <div class="col-sm-3 file-name">
                                    max file size : {{getUserMaxFileSize(user)}}<br/>
                                    max user size : {{getUserMaxUserSize(user)}}<br/>
                                    max TTL : {{getUserMaxTTL(user)}}
                                </div>
                                <div class="col-sm-3">
                                    <button title="Impersonate" type="button" class="btn btn-success"
                                            ng-click="impersonate(user)" ng-disabled="user.id === original_user.id">
                                        <i class="glyphicon glyphicon-ok"></i>
                                        <span class="hidden-xs hidden-sm hidden-md"> Impersonate</span>
                                    </button>
                                    <button title="Edit" type="button" class="btn btn-info"
                                            ng-click="editUser(user)">
                                        <i class="glyphicon glyphicon-pencil"></i>
                                        <span class="hidden-xs hidden-sm hidden-md"> Edit</span>
                                    </button>
                                    <button title="Edit" type="button" class="btn btn-danger"
                                            ng-click="deleteUser(user)">
                                        <i class="glyphicon glyphicon-remove"></i>
                                        <span class="hidden-xs hidden-sm hidden-md"> Delete</span>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- LOAD MORE UPLOADS -->
                    <div class="row" ng-if="display=='users' && cursor">
                        <div class="col-sm-12">
                            <div class="tile panel panel-body main" ng-click="displayUsers(true)">
                                <div class="row">
                                    <div class="col-xs-12 text-center">
                                        Load more users
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- UPLOADS -->
        <div class="row" ng-if="display=='uploads'">
            <div class="col-sm-12 col-centered">
                <div class="tile panel panel-body main">
                    <div class="row center-block text-center">
                        <div class="tile panel panel-body main text-center">
                            <p>
                                <p>
                                    sort by : <input type="radio" ng-model="sort_uploads.selected" value="date" name="sort" ng-change="displayUploads(false, user, token)"> Creation date
                                              <input type="radio" ng-model="sort_uploads.selected" value="size" name="sort" ng-change="displayUploads(false, user, token)"> Size
                                </p>
                                <p>
                                    order by : <input type="radio" ng-model="sort_uploads_order.selected" value="desc" name="order" ng-change="displayUploads(false, user, token)"> Descending
                                               <input type="radio" ng-model="sort_uploads_order.selected" value="asc" name="order" ng-change="displayUploads(false, user, token)"> Ascending
                                </p>
                                <p ng-if="user">
                                    user : {{ user }} <i class="fa fa-remove" ng-click="displayUploads(false)"></i>
                                </p>
                                <p ng-if="token">
                                    token : {{ token }} <i class="fa fa-remove" ng-click="displayUploads(false, user)"></i>
                                </p>
                            </p>
                        </div>
                    </div>
                    <!-- UPLOADS -->
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="tile panel panel-body main" ng-repeat="upload in uploads">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-4 small file-name">
                                        <!-- UPLOAD ID / LINK -->
                                        <a href="{{getUploadUrl(upload)}}">{{ upload.id }}</a>
                                        <br/>
                                        <!-- UPLOAD DATE -->
                                        uploaded : {{ upload.createdAt | date:'medium' }}
                                        <br/>
                                        <!-- EXPIRE DATE -->
                                        expire : {{ upload.expireAt | date:'medium' }}
                                        <!-- TOKEN -->
                                        <br ng-if="upload.user"/>
                                        <span ng-if="upload.user">
                                            user : <a href="" ng-click="displayUploads(false,upload.user)">{{ upload.user }}</a>
                                        </span>
                                        <br ng-if="upload.token"/>
                                        <span ng-if="upload.token">
                                            token : <a href="" ng-click="displayUploads(false,upload.user,upload.token)">{{ upload.token }}</a>
                                        </span>
                                    </div>
                                    <div class="col-xs-12 col-sm-6 small file-name">
                                        <div ng-repeat="file in upload.files | filter: {status: 'uploaded'}">
                                            <a href="{{getFileUrl(upload,file)}}">{{ file.fileName }}</a>
                                            <button style="background-color: transparent; border: none;" data-clipboard data-clipboard-text="{{getFileUrl(upload,file)}}">
                                                <span class="glyphicon glyphicon-copy"></span>
                                            </button>
                                            <span class="pull-right">{{ humanReadableSize(file.fileSize) }}</span>
                                        </div>
                                    </div>
                                    <div class="col-xs-12 col-sm-2 text-center">
                                        <!-- REMOVE -->
                                        <button class="btn btn-danger btn-sm" ng-click="deleteUpload(upload)">
                                            <span class="glyphicon glyphicon-remove"></span><span
                                                class="hidden-xs hidden-sm hidden-md"> Remove</span>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- LOAD MORE UPLOADS -->
                    <div class="row" ng-if="display=='uploads' && cursor">
                        <div class="col-sm-12">
                            <div class="tile panel panel-body main" ng-click="displayUploads(true)">
                                <div class="row">
                                    <div class="col-xs-12 text-center">
                                        Load more uploads
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>